Skip to content

add simplified chinese language option - #7

Merged
Eddykasp merged 10 commits into
mainfrom
mka/zh-locale
Sep 16, 2026
Merged

Eddykasp merged 10 commits into
mainfrom
mka/zh-locale

Conversation

@Eddykasp

@Eddykasp Eddykasp commented Jul 3, 2026

Copy link
Copy Markdown
Member

some of the translations here are a little clunky due to the sentence structure. In particular the tokens with _TEXT_START and _TEXT_END make it awkward. It would be nice to have more flexibility here.

The strings regarding lights, tracks and points are currently difficult to translate
In Chinese something like "light number one" would translate to "number one light", which the current structure of the strings does not really seem to allow as far as I can tell

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Simplified Chinese (zh-Hans) as a selectable UI/editor language in RailBlocks, and refines some existing English/German UI strings/tooltips to improve translation clarity and consistency.

Changes:

  • Introduces a new zh locale (custom RailBlocks tokens + Blockly zh-hans) and registers it in the localization system.
  • Adds a Simplified Chinese option to the language picker and ensures the page uses UTF-8.
  • Adjusts select English/German tooltips and UI labels for clearer phrasing.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/validate_translation_consistency.test.js Includes zh_locale in translation consistency checks.
locales/zh/zh_tokens.js Adds Simplified Chinese translations for block labels/tooltips/warnings.
locales/zh/zh_locale.js Adds the Simplified Chinese locale configuration and UI/toolbox labels.
locales/en/en_tokens.js Tweaks English tooltip/warning phrasing.
locales/en/en_locale.js Simplifies English save/load UI labels.
locales/de/de_tokens.js Tweaks German tooltip phrasing.
locales/de/de_locale.js Simplifies German save/load UI labels.
frontend/localization.js Registers zh in LANGUAGE_CONFIGS so it can be applied/stored.
frontend/index.html Adds UTF-8 meta tag and a Simplified Chinese language menu entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/index.html Outdated
Comment thread locales/zh/zh_locale.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Five unresolved Chinese localization issues remain in the final review comments.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (3)

locales/zh/zh_tokens.js:39

  • The %1 value is 到达 or 通过, but appending either after 被 produces malformed Chinese (被到达/被通过). This token is rendered by ContactWaitStatement, so put the action before the track/contact phrase to form valid text for both options.
    '等待直到 %3 的 %2 号触点被%1',

locales/zh/zh_tokens.js:64

  • The literal 第 is followed by dropdown values 第一/第二, yielding 第第一号/第第二号; it also uses 被到达, which is not grammatical Chinese. Rewrite this sentence using the existing placeholder order so the static conditional block renders correctly.
    '如果 %2 的第 %1 号触点最先被到达\n%3否则如果 %5 的第 %4 号触点最先被到达',

locales/zh/zh_tokens.js:72

  • The dynamic branch block appends these fragments as start → contact ordinal → middle → track → end 1 → end 2. The current values therefore render text such as 如果第一号触点,属于轨道KH_ST_0被优先, which is ungrammatical and does not clearly state what happens first; adjust the fragments for this fixed order.
  RAILBLOCKS_CONDITIONAL_TEXT_START: '如果',
  RAILBLOCKS_CONDITIONAL_TEXT_MIDDLE: '号触点,属于轨道',
  RAILBLOCKS_CONDITIONAL_TEXT_END_1: '被',
  RAILBLOCKS_CONDITIONAL_TEXT_END_2: '优先',
  • Files reviewed: 11/11 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread locales/zh/zh_locale.js Outdated
Comment thread locales/zh/zh_tokens.js Outdated
Eddykasp and others added 2 commits September 16, 2026 10:47
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Eddykasp
Eddykasp merged commit 0d72fb3 into main Sep 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants